package com.hp.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.hp.model.Types;

public interface TypesDao {

	@Select("select * from types")
	List<Types> findAlltypes();
	
	//新增类目
	@Insert("insert into types values(null,#{name},#{num})")
	Integer addtype(Types type);
	
	//通过id查找类目
	@Select("Select * from types where id=#{id}")
	Types findtype(@Param("id") Integer id);
	
	//修改
	@Update("update types set name=#{name},num=#{num} where id=#{id}")
	Integer edittype(Types type);
	
	//删除
	@Delete("delete from types where id=#{id}")
	Integer deltype(@Param("id") Integer id);
}
